﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmployeeProject
{
    class Worker : Employee
    {
        public double YearSalary { get; private set; }
        public double MonthSalary { get; private set; }

        public override void CalculateSalary()
        {
            MonthSalary = YearSalary / 12;
        }

        public Worker(string name, double yearsalary) :base(name)
        {
            if (yearsalary <= 0)
                throw new ArgumentOutOfRangeException("Salary is 0 or negative");
            YearSalary = yearsalary;
        }

        public override void PrintToConsole()
        {
            Console.WriteLine("{0} : {1}$", Name, MonthSalary);
        }
    }
}
